<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>初始Vue</title>
    <!--引入Vue-->
    <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
<!--准备好一个容器-->
<div class="root">
    <h2>今天天气很{{info}}</h2>
    <button @click="switchWeather">切换天气</button>
</div>


<script type="text/javascript">
    Vue.config.productionTip = false //阻止Vue在启动时生成生成提示

    new Vue({
        el:'.root',
        data:function () {
            return{
                isHot:true
            }
        },
        methods:{
            switchWeather(){
                this.isHot=!this.isHot;
            }
        },
        computed:{
            info(){
                return this.isHot?'炎热':'凉爽';
            }
        }

    })


</script>
</body>
</html>